#include "portallocatorsessionproxy.h"

namespace cricket
{
	enum
	{
		MSG_SEND_ALLOCATION_DONE = 1,
		MSG_SEND_ALLOCATED_PORTS,
	};

	typedef base::TypedMessageData<PortAllocatorSessionProxy*> ProxyObjData;

	PortAllocatorSessionMuxer::PortAllocatorSessionMuxer(PortAllocatorSession* session)
		: worker_thread_(base::Thread::Current()), session_(session), 
		candidate_done_signal_received_(false)
	{
		session_->SignalPortReady.connect(this, 
			&PortAllocatorSessionMuxer::OnPortReady);
		session_->SignalCandidatesAllocationDone.connect(this, 
			&PortAllocatorSessionMuxer::OnCandidatesAllocationDone);
	}

	PortAllocatorSessionMuxer::~PortAllocatorSessionMuxer()
	{
		for (size_t i = 0; i < session_proxies_.size(); ++i)
			delete session_proxies_[i];
		
		SignalDestroyed(this);
	}
}